<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>简书-写文章</title>
	<style>
		*{
		margin: 0;
		padding: 0;
		list-style: none;
		width: 100%;
		text-decoration: none;
		}
		#container_{
          width: 100%;
         
          height: 860px;
          display: flex;
          position: absolute;
		}
		#left{
         width: 400px;
         height: 860px;
         background: #555;
           float: left;

		}
		
		#right{
	     width: 950px;
	     height: 827px;
         background: #fff;
         
         /*
         static:相对定位并且位置参数无效
         relative:相对定位
         absolute:绝对于父元素
         fixed:绝对于浏览器
         */
         position: relative;
         
		}
		#btn1{
			width: 155px;
			height: 30px;
			text-align: center;
			border:1px solid #ec7259;
            margin-left:80px;
            margin-top: 70px;
            border-radius: 30px;
		}
		#btn1>a{
          
		}
		#btn1>a>span{
		  line-height: 30px;
		  text-align: center;
          font-size: 1.1em;
          color:#ec7259;
          padding-top: 5px;
		}
		#btn2{
			width: 155px;
			height: 30px;
			text-align: center;
			border:1px solid #ec7259;
            margin-left:80px;
		    border-radius: 30px;
		    margin-top: 40px;
		 
		}
		#btn2>a>span{
		  font-size: 1.1em;
          color:#ec7259;
          padding-top: 6px;
           line-height: 30px;
		}
	</style>
</head>
<body>
	<div id="container_">
		<div id="left">
			<div id="btn1">
				<a href="">
					<span>回首页</span>
				</a>
			</div>
		
		<div id="btn2">
			<a href="javascript:putArtic()">
				<span>发布文章</span>
			</a>
		</div>
		</div>
		<div id="right">
			 <!-- 加载编辑器的容器 -->
    <script id="container" name="content" type="text/plain">
    </script>
    <!-- 配置文件 -->
    <script type="text/javascript" charset="utf-8" src="/wsq/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="/wsq/ueditor.all.min.js"> </script>
    
    <!-- 实例化编辑器 -->
        <!-- 实例化编辑器 -->
 

		</div>
	</div>
	<script type="text/javascript">

		function putArtic() {
			var args={} //上传服务器的参数
			args['content']=UE.getEditor('container').getContent();
			args['userId'] = 1;//需要查询后台获取用户id

			

			//debugger;

			fetch('/zhifou/push',{
				method:'POST',
				body:Object.keys(args).map(el=>el+"="+args[el]).join('&'),
				headers:{
					"Content-type": "application/x-www-form-urlencoded; charset=utf-8"
				}
			})
			.then(function (rrr) {
				return rrr.json();
			})
			.then(function (aaa) {
				if(aaa.status==1){
					alert("添加成功")
					return aaa;
				}

			}).then(function (ccc) {
				// body...
			});

			
		}
		window.onload=function(){
			var ue = UE.getEditor('container');
		}
       
    </script>

</body>
</html>